/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package controller;

import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.validation.BindException;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractCommandController;
import model.Usuario;
import java.util.List;
import org.apache.log4j.Logger;
import service.UsuarioService;

/**
 *
 * @author MIS DOCUMENTOS
 */
public class DesactivarCuentaIndex extends AbstractCommandController {

    private UsuarioService usuarioService;
    private static Logger loggers = null;

    public void setUsuarioService(UsuarioService usuarioService) {
        this.usuarioService = usuarioService;
    }

    public DesactivarCuentaIndex() {
        this.setCommandClass(Usuario.class);
    }

    @Override
    protected ModelAndView handle(HttpServletRequest request, HttpServletResponse response, Object form, BindException errors) throws Exception {
        Map model = new HashMap();

        Usuario usuario = (Usuario) form;
        Usuario user2;
        List user;
        user2 = (Usuario) usuarioService.getUsuario(Long.parseLong(request.getParameter("ux")));

        request.getSession().setAttribute("usuarioList", null);
        model.put("title", "MODIFICAR DATOS");
        model.put("usuario", user2);
        return new ModelAndView("modificarCuenta", model);

    }
}
